
// 顶点着色器
const vss_s = `
    void main() {
      gl_Position = vec4(1, 1, 0, 1);
      gl_PointSize = 10.0;
    }
  `;
// 片元着色器
const fs_s = `
    void main() {
      gl_FragColor = vec4(1, 0, 0, 1);
    }
  `;

function main() {
  var canvas = document.getElementById('webgl');
  if (!canvas) {
    alert('Field of canvas by id');
    return false;
  }
  const gl = canvas.getContext('webgl');
  if (!gl) {
    alert('Field of got webgl.');
    return false;
  }

  if (!initShaders(gl, vss_s, fs_s)) {
    alert('Field for init shader');
    return false;
  }

  gl.clearColor(0,0,0,1);
  gl.clear(gl.COLOR_BUFFER_BIT);

  gl.drawArrays(gl.POINTS, 0, 1);
}